/*
This file is part of maven-rabbit-plugin.

maven-rabbit-plugin is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

maven-rabbit-plugin is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with maven-rabbit-plugin.  If not, see <http://www.gnu.org/licenses/>.
*/
package org.opensource.maven.rabbit;

import org.apache.maven.plugin.MojoExecutionException;

import java.io.IOException;
import java.net.URL;
import org.opensource.nabaztag.RabbitException;

/**
 * Stream sound to Nabaztag.
 *
 * @goal stream
 */
public class StreamMojo extends AbstractRabbitMojo {

    /**
     * @parameter expression="${rabbit.stream-url}
     * @required
     */
    private URL url;

    public void execute() throws MojoExecutionException {
        try {
            getRabbit().stream(this.url);
        } catch (RabbitException e) {
            throw new MojoExecutionException("Cannot stream url <"+this.url+">", e);
        } catch (IOException e) {
            throw new MojoExecutionException("Cannot stream url <"+this.url+">", e);
        }
    }

}
